package com.sl.au.controller;

import com.sl.au.entity.Account;
import com.sl.au.entity.Module;
import com.sl.au.entity.News;
import com.sl.au.entity.User;
import com.sl.au.service.NewsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.servlet.ModelAndView;

import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 公司信息发布控制器
 */
@RestController

@RequestMapping(value = "/ui/newsShow")
public class NewsShowController extends BaseController {
    @Autowired
    com.sl.au.service.NewsService NewsService;
    @RequestMapping(method = RequestMethod.GET)
    public ModelAndView index() {
        ModelAndView modelAndView = createLayoutView("newsShow/newsShow");

        return modelAndView;
    }
//    @RequestMapping(value = "getpage", method = RequestMethod.GET)
//    public Map getPage(HttpServletRequest request) {
//    	Map<String, Object> map = new HashMap<String, Object>();
//    	Map<String, Object> condition = new HashMap<String, Object>();
//        int start = Integer.parseInt(request.getParameter("start"));
//        int length = Integer.parseInt(request.getParameter("length"));
//        String key=request.getParameter("key");
//        Account a = this.getMyAccount();
//		Module module = this.getPageModule("cir");
//        String dataFilter=module.getDataFilter();
//		User user = a.getUser();
//		condition.put("key", key);
//		condition.put("dataFilter", dataFilter);
//		condition.put("user", user);
//        List<News> news=null;
//            news = NewsService.getNews(start, length, condition, null, null);
//        Long count = NewsService.getNewsCount(condition);
//        map.put("data", news);
//        map.put("draw", request.getParameter("draw"));
//        map.put("recordsFiltered", count);
//        map.put("recordsTotal", count);
//        return map;
//    }
}
